#include<bits/stdc++.h>
#define mp make_pair
using namespace std;
vector<pair<string, string>> v;
int op;
string key, value;
struct isEqual {
    string key;
    isEqual(string k) : key(k) {}
    bool operator() (const std::pair<string, string>& element) const {
        return element.first == key;
    }
};
int main() {
    freopen("./03.in", "r", stdin);
    while (true) {
        cin >> op;
        if (op == 0) {
            cin >> key >> value;
            auto it = find_if(v.begin(), v.end(), isEqual(key));
            if (it != v.end()) {
                cout << "insert failed\n";
            } else {
                v.push_back(mp(key, value));
                cout << "insert succeed\n";
            }
        } else if (op == 1) {
            cin >> key;
            auto it = find_if(v.begin(), v.end(), isEqual(key));
            if (it != v.end()) {
                cout << it->second << endl;
            } else {
                cout << "select failed\n";
            }
        } else if (op == 2) {
            if (v.empty()) {
                cout << "empty\n";
            } else {
                for (auto it : v) {
                    cout << it.first << " " << it.second << endl;
                }
            }
        } else if (op == 3) {
            cin >> key;
            auto it = find_if(v.begin(), v.end(), isEqual(key));
            if (it != v.end()) {
                v.erase(it);
                cout << "delete succeed\n";
            } else {
                cout << "delete failed\n";
            }
        } else if (op == 4) {
            v.clear();
            cout << "delete succeed\n";
        } else if (op == 5) {
            break;
        }
    }
    return 0;
}